package com.webqq.client.task;

import com.webqq.client.service.WebqqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2017/9/28 0028.
 */
@Component
public class WebqqEvent {
    private Integer count_first = 1;
    @Autowired
    private WebqqService webqqService;
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    @Scheduled(fixedRate = 3000)
    public void webEvent() {
        try {
            System.out.println(String.format("① 第%s次执行，当前时间为：%s", count_first++, dateFormat.format(new Date())));
            System.out.println( webqqService.checkEvent());
           // webqqService.sendFriendMessage(2798622761L,dateFormat.format(new Date()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
